<%@page import="java.util.ArrayList"%>
<%@page import="java.lang.reflect.Array"%>
<%@page import="java.util.List"%>
<%@page import="com.situ.student.entity.Student"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
	<!-- El从域中取出数据 -->
	
	<% 
		//获得普通字符串
		pageContext.setAttribute("name", "zhangsan");
		request.setAttribute("name", "lisi");
		
		//获得student对象的值
		Student student = new Student("lisi",21,"男");
		session.setAttribute("student", student);
		
		//获得List<student>的值
		List<Student> list = new ArrayList<Student>();
		Student student2 = new Student("wangwu",23,"男");
		Student student3 = new Student("maliu",24,"女");
		list.add(student2);
		list.add(student3);
		application.setAttribute("list", list);
	%>
	
	
	
	<!-- 获取域中的数值 -->
	
	<!-- 普通字符串 -->
	<!-- jsp表达式 -->
	<%=pageContext.getAttribute("name")%>
	<%=request.getAttribute("name")%><br/>
	<%=pageContext.getAttribute("nanme") %>
	<%=request.getAttribute("name") %>
	<!-- El表达式 -->
	${pageScope.name}<br/>
	${requestScope.name}<br/>
	<hr/>
	
	
	
	
	
	<!-- student对象的值 -->
	<!-- jsp表达式 -->
	<%
	Student stu = (Student)session.getAttribute("student");
	%>  
	<%=stu.getName()%><br/>
	<%=stu.getGender()%><br/>
	<!-- El表达式 -->
	${sessionScope.student.name}<br/>
	${sessionScope.student.gender}<br/><hr/>






	<!-- List<studnet>的值 -->
	<!-- jsp表达式 -->
	<%
		List<Student> list2 = (List<Student>) application.getAttribute("list");
	%>
	<%=list2.get(0).getName()%><br/> <!-- 拿到集合的下标为0，第一位的name -->
	<%=list2.get(1).getGender() %>
	<!-- El表达式 -->
	${applicationScope.list[1].name}<br/>
	${applicationScope.list[1].gender}<br/>
	${applicationScope.list[0].name}<br/>
	${applicationScope.list[1].gender}<br/>
	${applicationScope.list[0].age}<hr/>
	
	
	
	<!-- El全域查找 ,当域中的数值不重名是，直接写，不加XXXXScope-->
	${name}<br/> 
	${student.name}--${student.gender}<br/>
	${list[1].age}<hr/>
	
	
	
	
</html>
